import 'package:flutter/material.dart';

class HomeTabCountWidget extends StatefulWidget {
  final int totalCount;

  HomeTabCountWidget(this.totalCount);

  @override
  _HomeTabCountWidgetState createState() => _HomeTabCountWidgetState();
}

class _HomeTabCountWidgetState extends State<HomeTabCountWidget> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
            alignment: Alignment.topLeft,
            margin: EdgeInsets.only(left: 12, top: 8, bottom: 10),
            child: Text(" 未处理报警动态")),
        FractionallySizedBox(
            widthFactor: 1,
            child: Container(
                margin: EdgeInsets.fromLTRB(9, 0, 9, 0),
                child: Container(
                  decoration: BoxDecoration(
                      image: DecorationImage(
                          image: ExactAssetImage(widget.totalCount == 0
                              ? 'images/bg_border_green.png'
                              : 'images/bg_border_red.png'),
                          fit: BoxFit.fill),
                      borderRadius: BorderRadius.all(Radius.circular(5))),
//                            padding: EdgeInsets.all(12),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Container(
                        margin: EdgeInsets.fromLTRB(16, 10, 10, 5),
                        child: Text(
                          '${widget.totalCount}',
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 36,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.fromLTRB(16, 0, 10, 10),
                        child: Text("当前未处理报警数量(个)",
                            style:
                                TextStyle(color: Colors.white, fontSize: 20)),
                      )
                    ],
                  ),
                ))),
      ],
    );
  }
}
